from django.urls import path, re_path
from rest_framework.urlpatterns import format_suffix_patterns
from drfUser import views
from django.conf import settings
from django.conf.urls.static import static
urlpatterns = [
    # user增删改查查，使用两个CBV
    path('user/', views.UserView.as_view()),
    path('user/register/', views.RegisterView.as_view()),
    path('user/<int:pk>/', views.UserViewDetails.as_view()),
    path('user/<str:pk>/', views.UserViewDetails.as_view()),
    path('user/login/logs/', views.LoginLogsView.as_view({
        "get": "get_all"
    })),
    path('user/login/cat/<str:keywords>/', views.LoginLogsView.as_view({
        "get": "list"
    })),
    # user的过滤查询，使用一个CBV
    path('user/cat/<str:keywords>/', views.UserFilterView.as_view({
        "get": "list",
        "post": "img_upload"
    })),
    # group增删改查查，使用一个CBV,利用了**kwargs传参
    path('group/', views.GroupView.as_view(), kwargs={'pk': None}),
    path('group/<int:pk>/', views.GroupView.as_view()),
    path('tasks/', views.CreateTaskView.as_view()),
    path('login/', views.LoginView.as_view()),
    path('logout/', views.LogoutView.as_view()),
    path('modpwd/', views.ModifyPasswordView.as_view()),
    path('resetpwd/', views.ResetPasswordView.as_view()),
    path('captcha/', views.CaptchaView.as_view()),
    path('apsscheduler/', views.APSSchedulerView.as_view()),
    path('ip/', views.IpView.as_view()),
    path('sendEmail/', views.SendEmailView.as_view()),
    path('toutiao/', views.TouTiaoView.as_view()),
    path('yiyan/', views.WitticismView.as_view()),
    path('count/', views.CountView.as_view()),

] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)